package cn.ante.basic.config;

//import cn.ante.basic.interceptor.LoginInterceptor;
import cn.ante.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(loginInterceptor)
        .addPathPatterns("/**") // 拦截所有页面接口
                .excludePathPatterns(
                        "/login/**", // 放行登录接口
                        "/verifyCode/**", // 放行验证码接口
                        "/fastdfs/**", // 放行文件上传接口
                        "/shop/settlement/**", // 放行商家入驻接口
                        "/user/register/**"); // 放行用户注册接口
    }
}
